package framework.system.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import framework.core.util.ListRange;
import framework.system.entity.SysRole;
import framework.system.entity.front.Role;

/**
 * @ClassName: IRoleService 
 * @Description: 角色Service接口
 * @author: Ching Wang
 * @date 2013-5-18 下午2:39:10 
 *
 */
@Service("roleService")
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public interface IRoleService {

	/**
	 * @Title: findAll 
	 * @Description: 查找所有角色
	 * @return List<SysRole>
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract  List<SysRole> findAll() throws Exception;
	
	/**
	 * @Title: getRole 
	 * @Description: 通过角色ID获取角色
	 * @param roleId 角色ID
	 * @return SysRole
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract SysRole getRole(String roleId) throws Exception;

	/**
	 * @Title: getCount 
	 * @Description: 获取符合条件的角色总数 
	 * @param criteria 查询条件
	 * @return long
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract long getCount(DetachedCriteria criteria) throws Exception;

	/** 
	 * @Title: listRole 
	 * @Description: 分页查询符合特定条件的角色信息
	 * @param criteria 查询条件集合
	 * @param page 第page页
	 * @param rows 获取rows条数据
	 * @return List<SysRole>
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract List<SysRole> listRole(DetachedCriteria criteria, String page, String rows) throws Exception;

	/** 
	 * @Title: saveOrUpdate 
	 * @Description: 保存或更新角色信息
	 * @param sysRole 角色实体对象
	 * @throws Exception
	 */
	public abstract void saveOrUpdate(SysRole sysRole) throws Exception;

	/** 
	 * @Title: delRole 
	 * @Description: 删除角色信息
	 * @param roleIds 角色编号集合
	 * @return ListRange<Role> 
	 * @throws Exception
	 */
	public abstract ListRange<Role> delRole(String[] roleIds) throws Exception;
}
